package eu.vranckaert.calendar.util;

import android.annotation.TargetApi;
import android.os.AsyncTask;
import android.os.Build;

public class AsyncHelper {
	public static void start(AsyncTask task) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[]{});
        } else {
            task.execute();
        }
    }

    public static void startWithParams(AsyncTask task, Object[] params) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
        } else {
            task.execute(params);
        }
    }
}